Skip to content

fix(routing): honor edited custom-node API type - #12358

Merged
diegosouzapw merged 5 commits into
diegosouzapw:release/v3.8.51from
pacocartones:fix/11884-custom-node-api-type-pc
Sep 11, 2026
Merged

diegosouzapw merged 5 commits into
diegosouzapw:release/v3.8.51from
pacocartones:fix/11884-custom-node-api-type-pc

Conversation

@pacocartones

Copy link
Copy Markdown
Contributor

Summary

  • Honor an edited custom OpenAI-compatible node's saved Chat/Responses API type at dispatch time.
  • Keep the credential-blind effective format available for existing callers, but forward only an explicit custom-model DB override as modelInfo.targetFormat, so chat core's credential-aware resolution picks the live connection setting instead of the format baked into the node id at creation.

Related Issues

Validation

  • Change type: routing
  • Focused tests and category gates from the golden path: tests/integration/chat-pipeline.test.ts (#11884 chat pipeline sends a custom node's edited Chat API type upstream) 1/1, tests/unit/chat-helpers.test.ts 28/28, npm run typecheck:core exit 0, focused ESLint exit 0, git diff --check clean, check:changelog-integrity OK
  • npm run lint — exit 0 with --pass-on-unpruned-suppressions; the literal command exits 2 only because the merged base leaves unused global suppressions (eslint 10), no rule violation reported
  • Reconciled with the current active release base release/v3.8.51@158647618; focused checks rerun afterward
  • Production-code changes include new automated tests in this PR
  • SonarQube is temporarily opt-in while the private project has no quota; it is not a PR gate.

Regression proof at the sink: with the src/sse/handlers/chat.ts forwarding hunks reverted, the new integration test fails (the saved Chat API type must produce a Chat Completions body, the upstream body is Responses-shaped); with the fix restored it passes.

Pre-existing, unrelated: three other cases in tests/integration/chat-pipeline.test.ts fail identically on the untouched base with upstream 410 "Model claude/claude-3-5-sonnet-20241022 was shut down" / 502.

Tests Added Or Updated

  • tests/integration/chat-pipeline.test.ts — creates a custom node whose id still encodes the Responses type, edits it to Chat through the real PUT /api/provider-nodes/[id] handler, drives handleChat with a strict globalThis.fetch double and asserts the captured upstream call is POST {baseUrl}/chat/completions with a messages body and no input.
  • tests/unit/chat-helpers.test.ts — #11884 configured Chat API type wins after custom-node model resolution pins the resolver-level customModelTargetFormat contract.

Coverage Notes

  • src/sse/handlers/chat.ts and src/sse/handlers/chatHelpers.ts are exercised by both tests above; the integration test covers the full request path through the fetch sink.
  • No file's coverage moved down.

Reviewer Notes

  • The node id keeps encoding the creation-time API type on purpose (ids are immutable); the fix changes only which value wins at dispatch.
  • Behaviour for nodes that were never edited is unchanged: the explicit override is only forwarded when a custom-model DB override exists.

The regression is covered at the sink: an integration test drives handleChat
through the real PUT /api/provider-nodes/[id] edit and asserts the captured
upstream request uses the edited Chat Completions shape.

Closes diegosouzapw#11884

Co-authored-by: Leon Marcos <leonaniagomez@gmail.com>
pacocartones added a commit to pacocartones/OmniRoute that referenced this pull request Sep 1, 2026
@pacocartones
pacocartones force-pushed the fix/11884-custom-node-api-type-pc branch from 6a681a3 to 5df0c34 Compare September 1, 2026 23:26
pacocartones and others added 3 commits September 2, 2026 00:41
Co-authored-by: Leon Marcos <leonaniagomez@gmail.com>
…iegosouzapw#11884 case

One new end-to-end case, +88 lines. Irreducible at this layer: the point of
the test is the full route-to-upstream path, which is what diegosouzapw#11884 regressed.
@diegosouzapw
diegosouzapw merged commit 7cd2fab into diegosouzapw:release/v3.8.51 Sep 11, 2026
8 of 16 checks passed
Githab-capibara added a commit to Githab-capibara/OmniRoute that referenced this pull request Sep 17, 2026
Forwarding only an explicit custom-model DB override as `modelInfo.targetFormat` is the key distinction — it lets chat core's credential-aware resolution pick the live connection setting instead of the format baked into the node id at creation, which is exactly what diegosouzapw#11884 was about. I rebaselined the integration test file for the new case.

---

Validated in one consolidated worktree cut from `release/v3.8.51`, boarded with the rest of this batch — zero conflicts between the 19 PRs.

- `typecheck:core` clean; `check:dashboard-typecheck` OK (206 pre-existing, all within the frozen baseline); `check:changelog-integrity` OK
- complexity 2802 / baseline 3218 and cognitive-complexity 1267 / baseline 1437 — both under baseline
- 226 of 228 focused assertions green across the batch's 23 test files. The 2 remaining belong to diegosouzapw#12551, which is held separately.

Two batch-owned defects were found and fixed in flight, both pure base drift: `173_xp_action_counts.sql` collided with `173_call_logs_video_content_removed.sql` (renumbered to 176 on diegosouzapw#12651 — it aborted every DB open, which is what 53 of the first run's failures were), and the feature-flag catalog was missing the `SERVER_OWNED_TOOL_LOOP_ENABLED` row the base gained after diegosouzapw#12552 was written.

⚠️ base-red inherited: diegosouzapw#12732 — `Docs Gates`, `Merge integrity`, `No new ESLint warnings`, `Unit Tests fast-path` and `Fast Quality Gates` reproduce on the pure tip (provider count 356 vs the 358 the modules define, SKILL.md drift, and `open-sse/utils/stream.ts` at 3115 > frozen 3098, which this batch does not touch).

Thanks @pacocartones — the `file:line` citations and the explicit out-of-scope notes on every one of these made a 19-PR batch reviewable in one pass.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
Forwarding only an explicit custom-model DB override as `modelInfo.targetFormat` is the key distinction — it lets chat core's credential-aware resolution pick the live connection setting instead of the format baked into the node id at creation, which is exactly what diegosouzapw#11884 was about. I rebaselined the integration test file for the new case.

---

Validated in one consolidated worktree cut from `release/v3.8.51`, boarded with the rest of this batch — zero conflicts between the 19 PRs.

- `typecheck:core` clean; `check:dashboard-typecheck` OK (206 pre-existing, all within the frozen baseline); `check:changelog-integrity` OK
- complexity 2802 / baseline 3218 and cognitive-complexity 1267 / baseline 1437 — both under baseline
- 226 of 228 focused assertions green across the batch's 23 test files. The 2 remaining belong to diegosouzapw#12551, which is held separately.

Two batch-owned defects were found and fixed in flight, both pure base drift: `173_xp_action_counts.sql` collided with `173_call_logs_video_content_removed.sql` (renumbered to 176 on diegosouzapw#12651 — it aborted every DB open, which is what 53 of the first run's failures were), and the feature-flag catalog was missing the `SERVER_OWNED_TOOL_LOOP_ENABLED` row the base gained after diegosouzapw#12552 was written.

⚠️ base-red inherited: diegosouzapw#12732 — `Docs Gates`, `Merge integrity`, `No new ESLint warnings`, `Unit Tests fast-path` and `Fast Quality Gates` reproduce on the pure tip (provider count 356 vs the 358 the modules define, SKILL.md drift, and `open-sse/utils/stream.ts` at 3115 > frozen 3098, which this batch does not touch).

Thanks @pacocartones — the `file:line` citations and the explicit out-of-scope notes on every one of these made a 19-PR batch reviewable in one pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(providers): Changing Custom Node API Type (Chat vs Responses) has no effect at runtime in v3.8.50 (regression from v3.8.49)

2 participants